home *** CD-ROM | disk | FTP | other *** search
- function pushGrid(obj, isnew)
- {
- if(!obj.removing)
- {
- if(isnew || Math.floor(obj.oldx / grid_width) != Math.floor(obj._x / grid_width) || Math.floor(obj.oldy / grid_width) != Math.floor(obj._y / grid_width))
- {
- myGrid.pop(obj.oldx,obj.oldy,obj,"tgt_ball");
- myGrid.push(obj._x,obj._y,obj,"tgt_ball");
- }
- }
- }
- function go(obj, frame)
- {
- obj.roll_frame += frame;
- obj.roll_frame %= obj.flower.roll_mc._totalframes;
- obj.flower.roll_mc.gotoAndStop(Math.round(obj.roll_frame) + 1);
- }
- function dis_func(mc1, mc2)
- {
- if(typeof mc1 != "movieclip")
- {
- var _loc4_ = mc1.x - mc2._x;
- var _loc3_ = mc1.y - mc2._y;
- }
- else if(typeof mc2 != "movieclip")
- {
- _loc4_ = mc1._x - mc2.x;
- _loc3_ = mc1._y - mc2.y;
- }
- else
- {
- _loc4_ = mc1._x - mc2._x;
- _loc3_ = mc1._y - mc2._y;
- }
- dis = Math.sqrt(Math.pow(_loc4_,2) + Math.pow(_loc3_,2));
- return dis;
- }
- function updatePos(obj, _speed, isNew)
- {
- if(_root.ball_number_n == 0 && balls_num < 18)
- {
- now_type_tmp_arr = [];
- for(var _loc7_ in tgt_mcs)
- {
- if(tgt_mcs[_loc7_].type < 7 && tgt_mcs[_loc7_].type != undefined && tgt_mcs[_loc7_].type != 11 && tgt_mcs[_loc7_].type != 9 && String(typeof tgt_mcs[_loc7_]).length != 0)
- {
- now_type_tmp_arr.push(tgt_mcs[_loc7_].type);
- }
- }
- }
- lost_pox = {x:pos_array[pos_array.length - 1].x,y:pos_array[pos_array.length - 1].y};
- hold_mx.x = pos_array[pos_array.length - 3].x;
- hold_mx.y = pos_array[pos_array.length - 3].y;
- obj.oldx = int(obj._x);
- obj.oldy = int(obj._y);
- if(obj.pos < pos_array.length * lineXishu)
- {
- var _loc5_ = Math.floor(obj.pos / lineXishu);
- var _loc8_ = obj.pos - _loc5_ * lineXishu;
- var _loc6_ = new Object();
- _loc6_.dx = _loc8_ * pos_array[_loc5_].dx;
- _loc6_.dy = _loc8_ * pos_array[_loc5_].dy;
- _loc6_.dr = _loc8_ * pos_array[_loc5_].dr;
- obj._x = int(pos_array[_loc5_].x + _loc6_.dx);
- obj._y = int(pos_array[_loc5_].y + _loc6_.dy);
- }
- if(holdBall_mc.hold_mc != undefined && obj.hitTest(holdBall_mc.hold_mc.trg))
- {
- if(_root.EndBall != obj)
- {
- hold_mx.num = hold_mx.num + 1;
- var _loc2_ = [obj];
- sp_xiqiu = true;
- var _loc3_ = new Object();
- _loc3_.tgt_remove_num = 0;
- _loc3_.id = random(65535);
- _loc3_.remove_array = _loc2_;
- remove_arr_array[_loc3_.id] = _loc3_;
- remove_sound.start(0);
- i = 0;
- while(i < _loc2_.length)
- {
- _loc2_[i].remove_id = _loc3_.id;
- myGrid.pop(_loc2_[i]._x,_loc2_[i]._y,_loc2_[i],"tgt_ball");
- _loc2_[i].removing = true;
- _loc2_[i].gotoAndPlay("remove");
- i++;
- }
- if(_root.ball == undefined)
- {
- _root.crtNewBall();
- }
- if(hold_mx.num >= 3)
- {
- _root.holdBall2 == false;
- _root.holdBall = false;
- holdBall_mc.hold_mc.unloadMovie();
- hold_mx.num = 0;
- }
- }
- }
- holdBall_mc.hold_mc.show_txt.text = 3 - hold_mx.num;
- }
- function push_balls(obj, _speed)
- {
- if(!Allstop)
- {
- obj.pos += _speed;
- }
- else
- {
- obj.pos += 0;
- }
- updatePos(obj,_speed,false);
- if(obj.right._name != undefined)
- {
- if(obj._currentframe < 12)
- {
- return push_balls(obj.right,_speed);
- }
- remove_movie_end(obj.remove_id);
- }
- return obj;
- }
- function pull_balls(obj, _speed)
- {
- obj.pos += _speed;
- trace(" carry from pull_balls ");
- updatePos(obj,_speed,false);
- if(obj.left._name != undefined)
- {
- return pull_balls(obj.left,_speed);
- }
- return obj;
- }
- function find_break_ball(obj)
- {
- if(obj.left._name != undefined)
- {
- return find_break_ball(obj.left);
- }
- return obj;
- }
- function find_last()
- {
- var _loc1_ = undefined;
- if(last_ball._name == undefined)
- {
- _loc1_ = firstBall;
- }
- else
- {
- _loc1_ = last_ball;
- }
- while(_loc1_.right._name != undefined || _loc1_.link_right._name != undefined)
- {
- if(_loc1_.right._name != undefined)
- {
- _loc1_ = _loc1_.right;
- }
- else if(_loc1_.link_right._name != undefined)
- {
- _loc1_ = _loc1_.link_right;
- }
- }
- last_ball = _loc1_;
- if(last_ball._name != undefined)
- {
- last_pos = last_ball.pos;
- last_pos -= last_pos % posXishu;
- }
- }
- function goback_all_balls()
- {
- var _loc1_ = firstBall;
- _loc1_.pos += all_forward_speed;
- trace(all_forward_speed);
- updatePos(_loc1_,all_forward_speed,false);
- trace(" carry from goback_all_balls ");
- while(_loc1_.right._name != undefined || _loc1_.link_right._name != undefined)
- {
- if(_loc1_.right._name != undefined)
- {
- _loc1_ = _loc1_.right;
- }
- else if(_loc1_.link_right._name != undefined)
- {
- _loc1_ = _loc1_.link_right;
- }
- _loc1_.pos += all_forward_speed;
- trace(" carry from all_forward_speed ");
- updatePos(_loc1_,all_forward_speed,false);
- }
- }
- function align_left_balls(obj)
- {
- while(obj._name != undefined)
- {
- obj.pos = obj.left.pos + posXishu;
- obj = obj.right;
- }
- }
- function align_right_balls(obj)
- {
- while(obj._name != undefined)
- {
- obj.pos = obj.right.pos - posXishu;
- obj = obj.left;
- }
- }
- function break_array_pop(obj)
- {
- i = 0;
- while(i < break_array.length)
- {
- if(break_array[i] == obj)
- {
- obj.goback_speed = 0;
- obj.goback_speed2 = 0;
- break_array.splice(i,1);
- break;
- }
- i++;
- }
- }
- function getNewType(oldtype)
- {
- if(tgt_same_num < tgt_same_total)
- {
- return oldtype;
- }
- tgt_same_num = 0;
- tgt_same_total = tgt_same_base + random(tgt_same_change);
- do
- {
- var newType = random(tgt_type) + 1;
- }
- while(newType == oldtype);
-
- return newType;
- }
- function mcDistance(mc0, mc1)
- {
- var _loc2_ = mc0._x - mc1._x;
- var _loc1_ = mc0._y - mc1._y;
- return Math.sqrt(_loc2_ * _loc2_ + _loc1_ * _loc1_);
- }
- function mcDistance2(mc0, mc1)
- {
- return Math.abs(mc0.pos - mc1.pos);
- }
- function setTag(obj, tag_bool)
- {
- obj.tag = "";
- if(!(random(tagTime) == 0 && tag_bool))
- {
- obj.flower.tag_mc.stop();
- obj.flower.tag_mc._visible = false;
- }
- }
- function setMotherDir(rada)
- {
- if(dir_bool)
- {
- var _loc1_ = new Object();
- var _loc3_ = new Object();
- var _loc2_ = new Object();
- _loc1_.x = ball.x;
- _loc1_.y = ball.y;
- _loc1_ = find_dir(_loc1_,rada);
- _loc3_.x = Math.round(ball.x - 3 * Math.sin(rada));
- _loc3_.y = Math.round(ball.y + 3 * Math.cos(rada));
- _loc2_.x = Math.round(ball.x + 3 * Math.sin(rada));
- _loc2_.y = Math.round(ball.y - 3 * Math.cos(rada));
- dir_mc.clear();
- dir_mc.beginFill(16711680,30);
- dir_mc.moveTo(_loc1_.x,_loc1_.y);
- dir_mc.lineTo(_loc3_.x,_loc3_.y);
- dir_mc.lineTo(_loc2_.x,_loc2_.y);
- dir_mc.lineTo(_loc1_.x,_loc1_.y);
- dir_num++;
- trace(dir_num + ":" + dir_num_total);
- if(dir_num >= dir_num_total)
- {
- dir_bool = false;
- dir_mc.clear();
- }
- }
- }
- function outOfScene(pos)
- {
- return pos.x < 0 || pos.y < 0 || pos.x > sceneWidth || pos.y > sceneHeight || mouth_start.pro_area.hitTest(pos.x,pos.y,true);
- }
- function find_dir(pos, rada)
- {
- var _loc4_ = undefined;
- var _loc2_ = width * 2 - 1;
- while(!outOfScene(pos))
- {
- pos.x += _loc2_ * Math.cos(rada);
- pos.y += _loc2_ * Math.sin(rada);
- }
- return pos;
- }
- function ball_boom(boom_obj)
- {
- _root.Boom_blo = true;
- _root.boom_num = 0;
- if(firstBall._name != undefined && boom_obj._name != undefined)
- {
- var _loc3_ = firstBall;
- var _loc6_ = random(65535);
- if(mcDistance(boom_obj,_loc3_) < boom_area && _root.jumpBall != true)
- {
- var _loc4_ = new Object();
- _loc4_.tgt_remove_num = 0;
- _loc4_.id = _loc6_;
- _loc4_.remove_array = new Array();
- _loc4_.remove_array.push(_loc3_);
- remove_arr_array[_loc6_] = _loc4_;
- _loc3_.remove_id = _loc6_;
- }
- while(_loc3_.right._name != undefined || _loc3_.link_right._name != undefined)
- {
- if(_loc3_.right._name != undefined)
- {
- _loc3_ = _loc3_.right;
- }
- else if(_loc3_.link_right._name != undefined)
- {
- _loc3_ = _loc3_.link_right;
- }
- if(mcDistance(boom_obj,_loc3_) < boom_area && _root.jumpBall != true)
- {
- _root.boom_num = _root.boom_num + 1;
- _loc6_ = random(65535);
- _loc4_ = new Object();
- _loc4_.tgt_remove_num = 0;
- _loc4_.id = _loc6_;
- _loc4_.remove_array = new Array();
- remove_arr_array[_loc6_] = _loc4_;
- _loc3_.checkTag = false;
- _loc3_.remove_id = _loc6_;
- remove_arr_array[_loc6_].remove_array.push(_loc3_);
- if(_loc3_.tag == "bo")
- {
- var _loc5_ = _loc3_.idnum;
- var _loc7_ = _root.attachMovie("showTebieCartoon","showTebieCartoon" + _root.getNextHighestDepth(),_root.getNextHighestDepth());
- _loc7_._x = _loc3_._x;
- _loc7_._y = _loc3_._y;
- trace(" what_sig = " + _loc5_);
- _loc7_.pic.gotoAndStop(_loc5_);
- var _loc2_ = 0;
- while(_loc2_ < cha_arr.length)
- {
- if(_loc5_ == cha_arr[_loc2_] && cha_arr2[_loc2_] != 1)
- {
- if(cha_arr[_loc2_] == "h")
- {
- _root.poop1.gotoAndStop(2);
- }
- else if(cha_arr[_loc2_] == "n")
- {
- _root.poop3.gotoAndStop(4);
- }
- else if(cha_arr[_loc2_] == "o")
- {
- _root.poop2.gotoAndStop(3);
- }
- else if(cha_arr[_loc2_] == "e")
- {
- _root.poop4.gotoAndStop(5);
- }
- else if(cha_arr[_loc2_] == "y")
- {
- _root.poop5.gotoAndStop(6);
- }
- cha_arr.splice(_loc2_,1);
- cha_arr2.splice(_loc2_,1);
- cha_has++;
- }
- if(cha_has >= 5)
- {
- cha_has = 0;
- cha_arr = ["h","o","n","e","y"];
- cha_arr2 = [0,0,0,0,0];
- re_back_func_();
- _root.attachMovie("movieClassMC","movieClassMC" + _root.getNextHighestDepth(),_root.getNextHighestDepth(),{_x:158,_y:172});
- next_leve_func();
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- _loc3_.gotoAndPlay("boom");
- var _loc8_ = _root.attachMovie("appearPoint","appearPoint" + _root.getNextHighestDepth(),_root.getNextHighestDepth());
- _loc8_._x = remove_array[i]._x;
- _loc8_._y = remove_array[i]._y;
- _loc8_.addItemPoint = 10;
- myGrid.pop(_loc3_._x,_loc3_._y,_loc3_,"tgt_ball");
- _loc3_.removing = true;
- }
- }
- }
- _root.Boom_blo = false;
- }
- function setLife(num)
- {
- }
- function setGoal(num)
- {
- goal_total += num;
- trace(_root.tebl * num);
- _root.上一半分数 += _root.tebl * num;
- _root.下一半分数 += (1 - _root.tebl) * num;
- goal_total_mc.getNum(goal_total,goal_total_mc.obj,"mynum",12);
- }
- function setLevel(level_str)
- {
- trace(level_str + level_mc.getNum);
- level_mc.getNum(level_str,level_mc.obj,"mynum",12);
- }
- function setTgt_bar()
- {
- tgtNum_bar.getBallGS(tgt_totalNum - tgt_num,tgtNum_bar.obj,"mynum",12);
- }
- function initShowPara()
- {
- tgtNum_bar.bar._width = 0;
- life_mc.getNum(life,life_mc.obj,"mynum",12);
- goal_total_mc.getNum(0,goal_total_mc.obj,"mynum",12);
- level_mc.getNum("_",level_mc.obj,"mynum",12);
- }
- function winMove()
- {
- _root.center_mc._rotation = 90;
- line2.attachMovie("dot2","dot2" + last_pos,last_pos);
- line2["dot2" + last_pos]._x = pos_array[Math.floor(last_pos / lineXishu)].x;
- line2["dot2" + last_pos]._y = pos_array[Math.floor(last_pos / lineXishu)].y;
- EndBall._x = pos_array[Math.floor(last_pos / lineXishu)].x;
- EndBall._y = pos_array[Math.floor(last_pos / lineXishu)].y;
- setGoal(10);
- last_pos += posXishu;
- if(last_pos >= pos_array.length * lineXishu - posXishu)
- {
- EndBall.removeMovieClip();
- mouth.TX.gotoAndStop(1);
- delete move_listener_mc.onEnterFrame;
- mouth.attachMovie("shine2","shine",0);
- levelUp_sound.start(0);
- }
- }
- if(_root.unblack != undefined)
- {
- _root.unblack = undefined;
- }
- var hold_mx = {};
- hold_mx.num = 0;
-